
        /* 搜索栏 */
        var headwz=document.getElementsByClassName("head")[0];
        var wz=headwz.querySelectorAll("a");
        //console.log(headwz,wz);
        for(var i=0;i<wz.length;i++){
            wz[i].onclick=function(){
                for(var j=0;j<wz.length;j++){
                    wz[j].classList.remove("dh");
                }
                this.classList.add("dh");
            }
        }

        /* tab */
        var a=document.getElementsByClassName("abab");
        /* console.log(a); */
        for(var i=0;i<wz.length;i++){
            wz[i].index=i;
            wz[i].onclick=function(){
                for(var j=0;j<wz.length;j++){
                    wz[j].classList.remove("dh");
                    a[j].style.display="none";
                }
                this.classList.add("dh");
                a[this.index].style.display="block";
            }
        }

        /* 选项栏 */
        var gd=document.getElementsByClassName("swiper-wrapper")[0];
        var gdcur=gd.querySelectorAll("div");
        var nr=document.getElementsByClassName("nr");
        // console.log(gdcur,nr);
        for(var i=0;i<gdcur.length;i++){
            gdcur[i].index=i;
            gdcur[i].onclick=function(){
                for(var j=0;j<gdcur.length;j++){
                    gdcur[j].classList.remove("cur");
                    nr[j].style.display="none";
                }
                this.classList.add("cur");
                nr[this.index].style.display="block"
            }
        }


        /* fixed */
        var fixed1=document.getElementsByClassName("header")[0];
        var fixed2=document.getElementsByClassName("fixed")[0];
        // console.log(fixed1);
        // console.log(fixed2);
        window.onscroll=function(){
            var st=document.documentElement.scrollTop||document.body.scrollTop;
            var fixed=fixed2.offsetHeight;
            if(st>fixed){
                fixed1.style.position="fixed";
                fixed2.style.position="fixed";
            }else{
                fixed1.style.position="static";
                fixed2.style.position="static";
            }
        }


        /* tab + swiper */
        var swiper1 = new Swiper(".fixed", {
            slidesPerView: 5.5,
            spaceBetween: 10,
          });


        /* 幻灯片 */
        var swiper2 = new Swiper(".quanBu", {
            pagination: {
              el: ".swiper-pagination",
            },
          });


/* JSON */
var json=[{
    h3:"发售3年后，《辐射76》终于好评如潮了",
    zuo:"16分钟前·游戏综合",
    svg1:"#icon-cha",
    you:"45",
    svg2:"#icon-pinglun2",
    img:"./img/z_cfx/fs76.jpg",
},{
    h3:"退钱！——这几年游戏内容翻车的游戏",
    zuo:"43分钟前·游戏综合",
    svg1:"#icon-cha",
    you:"117",
    svg2:"#icon-pinglun2",
    img:"./img/z_cfx/IMG_2758.PNG",
},{
    h3:"《哈迪斯》获雨果奖最佳电子游戏奖 属首个获奖游戏",
    zuo:"1小时前·游戏综合",
    svg1:"#icon-cha",
    you:"134",
    svg2:"#icon-pinglun2",
    img:"./img/z_cfx/hds.jpg",
},{
    h3:"《Kingdom Rush》初代游戏背后的剧情故事",
    zuo:"1小时前·游戏综合",
    svg1:"#icon-cha",
    you:"55",
    svg2:"#icon-pinglun2",
    img:"./img/z_cfx/kd.jpg",
},{
    h3:"理智的想一想你在爱情里扮演了什么样的角色",
    zuo:"1小时前·情投一盒",
    svg1:"#icon-cha",
    you:"67",
    svg2:"#icon-pinglun2",
    img:"./img/z_cfx/IMG_2754.PNG",
},{
    h3:"《守望先锋》雪国仙境活动往年优质皮肤推荐及高清浏览",
    zuo:"2小时前·守望先锋",
    svg1:"#icon-cha",
    you:"72",
    svg2:"#icon-pinglun2",
    img:"./img/z_cfx/IMG_2757.PNG",
},{
    h3:"一些摸鱼必备游戏小网站（第二期）",
    zuo:"3小时前·游戏综合",
    svg1:"#icon-cha",
    you:"507",
    svg2:"#icon-pinglun2",
    img:"./img/z_cfx/IMG_2756.PNG",
},{
    h3:"Epic冬季特卖推荐（三）",
    zuo:"3小时前·游戏综合",
    svg1:"#icon-cha",
    you:"137",
    svg2:"#icon-pinglun2",
    img:"./img/z_cfx/IMG_2759.PNG",
}]
var div=document.querySelector(".js");
// console.log(div);
json.forEach(function(v,i){
    var pp=document.createElement("div");
    pp.innerHTML=`
    <div class="wenZi">
        <h3>${v.h3}</h3>
        <div class="zuoBox">
            <span>${v.zuo}</span>
            <svg class="icon" aria-hidden="true">
                <use xlink:href="${v.svg1}"></use>
            </svg>
        </div>
        <div class="youBox">
            <svg class="icon" aria-hidden="true">
                <use xlink:href="${v.svg2}"></use>
            </svg>
            <span>${v.you}</span>
        </div>
    </div>
    <img src="${v.img}"></img>
    `;
    div.appendChild(pp);
})